import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

import '../../common/system_config.dart';
import '../../model/initapp_model.dart';
import '../../utils/tools/screenutil_tool.dart';

class Networkoutage extends StatelessWidget {
  /// 提示文案，默认：网络连接不可用
  String tip;

  Networkoutage({ String title = "网络连接不可用" }) {
    this.tip = title;
  }

  @override
  Widget build(BuildContext context) {
    bool networkstate = Provider.of<InitAppModel>(context).networkstate;
    return !networkstate ? Container(
      width: double.infinity,
      padding: EdgeInsets.symmetric(horizontal: ST.setw(30),vertical: ST.seth(15)),
      color: Color.fromRGBO(255, 237, 237, 1),
      child: Row(
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          Icon(Icons.error,color: Colors.red),
          SizedBox(width: ST.setw(20)),
          Text("$tip",
            style: TextStyle(
              fontSize: ST.setsp(30),
              color: SystemConfig.grayColor
            )
          )
        ],
      ),
    ) : SizedBox.shrink();
  }

}